Programming With QuickTime Sprites

| Previous | Chapter Contents | Chapter Top | Next |

Actions for Sprites in a Sprite Track

The following actions enable you to control a sprite's spatial properties.

Constant descriptions

kActionSpriteSetMatrix
Supported Flags: IsDelta , WrapsAround Param1: [MatrixRecord matrix]

Sets the target sprite's matrix, allowing you to move, resize, rotate, and otherwise distort a sprite's shape. Sprites are clipped by their containing sprite track's bounds and clip region.

kActionSpriteSetImageIndex
Supported Flags: IsDelta , WrapsAround Param1: [short imageIndex] Default Min: 1, Default Max: num images

Sets the target sprite's image index. Each sprite track keyFrame contains a list of images. Setting a sprite's image index selects which image from this list is currently displayed. The image index ranges from 1 to the number of images.

kActionSpriteSetVisible
Supported Flags: isToggle Param1: [short visible]

Shows or hides the target Sprite.

kActionSpriteSetLayer
Supported Flags: IsDelta , WrapsAround Param1: [short layer]

Sets the target sprite's layer number. This is used to specify its front-to-back order relative to the other sprites in the sprite track. The smaller the layer number, the more forward the sprite appears. Note that 32767 indicates that this is a background sprite.

kActionSpriteSetGraphicsMode
Supported Flags: IsDelta Param1: [ModifierTrackGraphicsModeRecord graphicsMode]

Sets the target Sprite's graphics mode.

kActionSpritePassMouseToCodec
Supported Flags: none No Params

Passes the location of the mouse event to the codec that is drawing the sprite's current image. (Note that currently, only the Ripple codec accepts clicks, causing a ripple effect originating from the location).

It only makes sense to use this action in response to mouse- related events.

kActionSpriteClickOnCodec
Supported Flags: none Param1: [Point localLoc]

Passes the point localLoc to the codec that is drawing the sprite's current image. (Note that currently, only the Ripple codec accepts clicks, causing a ripple effect originating from the location.)

This action is similar to kActionPassMouseToCodec except the location to click on is a parameter, so it may be used in response to any type of event.

kActionSpriteTranslate
Supported Flags: none Param1: [Fixed x] Param2: [Fixed y] Param3: [Boolean isAbsolute]

If the isAbsolute parameter is true , this moves the sprite to the absolute location specified by the x and y parameters; if the isAbsolute parameter is false , it specifies how far from the current location to move the sprite. The coordinate system for x and y is the sprite track's source space.

kActionSpriteScale
Supported Flags: none Param1: [Fixed xScale] Param2: [Fixed yScale]

Scales the target sprite by xScale and yScale about its current image's registration point. For example, to double a sprite's width and half its height, you would set xScale to two and yScale to one-half.

kActionSpriteRotate
Supported Flags: none Param1: [Fixed degrees]

Rotates the target sprite about its current image's registration point. The amount of rotation is specified by degrees.

kActionSpriteStretch
Supported Flags: none Param1: [Fixed p1x] Param2: [Fixed p1y] Param3: [Fixed p2x] Param4: [Fixed p2y] Param5: [Fixed p3x] Param6: [Fixed p3y] Param7: [Fixed p4x] Param8: [Fixed p4y]

The eight parameters specify four corners of a four-sided polygon into which the sprite's image is "stretched." The coordinate system for points is the sprite track's source space.


© 1998 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |